#include "pcmfilespec.h"



void PCMFileSpec::copyFilePath(char *filePath)
{

    int len = 0;

    if(filePath != nullptr){

        len = strlen(filePath);
    }

    if(len > 0) {

        _filePath = new char[len+1]{};
        memcpy(_filePath,filePath,len);
    }

}

PCMFileSpec::PCMFileSpec():
    PCMFileSpec(0,0,AV_SAMPLE_FMT_NONE,nullptr)
{


}

PCMFileSpec::PCMFileSpec(int sampleRate, int channelLayout, AVSampleFormat format, char *filePath):
    PCMSpec(sampleRate,channelLayout,format)
{

    copyFilePath(filePath);
}

PCMFileSpec::~PCMFileSpec()
{

    if(_filePath != nullptr) {

        delete [] _filePath;
        _filePath = nullptr;
    }
}

char *PCMFileSpec::getFilePath()
{

    return _filePath;
}
